<%@ page contentType="text/html;charset=UTF-8"%>
<%@page import="java.util.Set"%>
<%@page import="com.sks.bean.privilege.PrivilegeGroup"%>
<%@ include file="../share/taglib.jsp"%>
<html>
<head>
<title>分配权限组</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" href="/css/vip.css" type="text/css">
<script language="JavaScript">
function bodyOnLoad() {
	<%
	Set<PrivilegeGroup> pgs = (Set<PrivilegeGroup>) request.getAttribute("usergroups");
	if (null != pgs) {
		for (PrivilegeGroup pg : pgs) {
		%>
	document.getElementById('pg_<%=pg.getGroupid()%>').checked = true;
		<%
		}
	}
	%>
}
function selectAllPG() {
	var selectAll = document.getElementById('selectAll');
	var ps = document.getElementsByName('groupids');
	if (selectAll != null && ps != null) {
		for (var i = 0; i < ps.length; i++) {
			ps[i].checked = selectAll.checked;
		}
	}
}
</script>
</head>
<body onload="bodyOnLoad();" bgcolor="#FFFFFF" text="#000000" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<html:form action="/cms/privilege/employee/manage.do" method="post">
	<input type="hidden" name="method" value="privilegeGroupSet">
	<html:hidden property="username" />
	<table width="90%" border="0" cellspacing="2" cellpadding="3" align="center">
		<tr bgcolor="#ffbe26">
			<td align="center" width="40%">权限代号</td>
			<td align="center" width="50%">权限组名称</td>
			<td align="center" width="10%"><input type="checkbox" id="selectAll" onclick="selectAllPG();" ${fn:length(groups) == fn:length(usergroups) ? "checked" : ""}/></td>
		</tr>
		<c:forEach items="${groups}" var="pg" varStatus="statu">
		<tr bgcolor="f5f5f5" onmouseover="this.style.background = '#ffbe26';" onmouseout="this.style.background = '';">
			<td align="center">${pg.groupid}</td>
			<td align="center">${pg.name}</td>
			<td align="center">
				<input type="checkbox" id="pg_${pg.groupid}" name="groupids" value="${pg.groupid}">
			</td>
		</tr>
		</c:forEach>
		<tr bgcolor="f5f5f5">
			<td colspan="3">
				<div align="center">
					<input type="submit" name="SYS_SET" value="<bean:message key="display.save"/>" class="frm_btn">
				</div>
			</td>
		</tr>
	</table>
</html:form>
</body>
</html>